package com.liyujie.dyeingmachine.pop;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.liyujie.dyeingmachine.R;
import com.liyujie.dyeingmachine.listener.OnGeneralCallback;
import com.lxj.xpopup.core.CenterPopupView;

public class EditDeletePopup extends CenterPopupView {

    /**
     * 回调
     */
    private OnGeneralCallback onGeneralCallback;

    public EditDeletePopup(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {

        return R.layout.popup_edit_delete;

    }

    @Override
    protected void onCreate() {
        super.onCreate();

        //修改
        findViewById(R.id.edit).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                if (null != onGeneralCallback) {
                    onGeneralCallback.onGeneralCallback(0);
                }
            }
        });
        //删除
        findViewById(R.id.delete).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                if (null != onGeneralCallback) {
                    onGeneralCallback.onGeneralCallback(1);
                }
            }
        });

    }

    public void setOnGeneralCallback(OnGeneralCallback onGeneralCallback) {
        this.onGeneralCallback = onGeneralCallback;
    }
}
